package com.wck.car.controller;

import com.wck.car.CarSeriesDescService;
import com.wck.car.model.CarSeriesDesc;
import com.wck.car.oyz.CarSeriesUpdate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class CarSeriesUpdateController {
    @Resource
    private CarSeriesDescService carSeriesDescService;


    @PostMapping("updateCarSeries")
    public void updateCarSeries(){
        List<CarSeriesDesc> list = carSeriesDescService.lambdaQuery().select(CarSeriesDesc::getCarSeriesLink, CarSeriesDesc::getId).list();
        list.parallelStream().forEach(e ->{
            CarSeriesUpdate.updateCarSeriesHtml(e);
            carSeriesDescService.updateById(e);
        });
    }
}
